<template>
  <div class="home">
    <button @click="getFn">发起一个get请求</button>
    <button @click="postFn">发起一个post请求</button>
    <!-- <div>
      <span @click="sub">-</span>
      <span ></span>
      <span @click="add">+</span>
    </div> -->
    <keep-alive></keep-alive>
  </div>
</template>

<script>
import {GetHomeAPI,PostLoginAPI} from '@/request/api.js'
export default {
  name: "HomeView",
  data() {
    return {
      username: "admin",
      password: "132456",
      loginFrom: {
        username: "admin",
        password: "132456",
      },
    };
  },
  methods: {
    getFn() {
      GetHomeAPI().then((res) => {
        console.log(res);
      });
    },
    postFn() {
      // axios
      //   .post(
      //     "http://127.0.0.1:8888/api/private/v1/login",
      //     `username=${this.username}&password=${this.password}`
      //   )
      //   .then((res) => {
      //     console.log(res);
      //   });
      PostLoginAPI(this.loginFrom).then(res=>{
        console.log(res);
      })
    },
  },
};
</script>
